
Page({
  data: {
    show1:false,
    show2:false,
    show3:false,
  },

  onLoad: function () {

  },
  onShow: function () {
    if(getApp().globalData.openid){
      this.getpersonEle()
    }
    this.nowyear();
    this.getRule()
    
  },
  changeshow:function(e){
    var name = e.currentTarget.dataset.id
    this.setData({
      nowmmmmm:name,
    })
  },
  changeshow2222:function(){
    this.setData({
      nowmmmmm:null,
    })
    console.log(this.data.nowmmmmm)
  
    
   
  },
  chosseto:function(){
    wx.switchTab({
      url: '/pages/scoreStore/scoreStore',
      });
  },
  getpersonEle:function(){
    var that = this;
    wx.request({
      url: getApp().globalData.baseUrl + '/wago/jifen/selectById',
      data: {
        userid:getApp().globalData.openid
      },
      method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      // header: {}, // 设置请求的 header
      success: function(res){
        // console.log('海报',res.data.data)
        // success
        if(res.data.flag){
          that.setData({
            eledata:res.data.data,
          })
        }
        console.log(that.data.eledata)
      },
      fail: function() {
        // fail
      },
      complete: function() {
        // complete
      }
    })
  },
  nowyear:function(){
    var myDate = new Date();
    var tYear = myDate.getFullYear();
    if(tYear == 2020){
      this.setData({
        ttty:2021
      })
    }else{
      this.setData({
        ttty:tYear
      })
      
    }
    console.log(this.data.ttty,6666)
  },
  getRule:function(){
    var that = this;
    wx.request({
      url: getApp().globalData.baseUrl + '/wago/explain/getAll',
      method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      // header: {}, // 设置请求的 header
      success: function(res){
        var arr = res.data.data;
        for(var i=0;i<arr.length;i++){
         arr[i].context = arr[i].context.replace(/\\/g, '').replace(/\<img/gi, '<img style="max-width:100%;height:auto"').replace( /^["|'](.*)["|']$/g, "$1")
        }
        that.setData({
          rulearr:arr
        })

      },
      fail: function() {
        // fail
      },
      complete: function() {
        // complete
      }
    })
  }


 
  

})